package com.ytjj.qmyx.supplychain.service;

import com.ytjj.qmyx.supplychain.mapper.EvaluationProductMapper;
import com.ytjj.qmyx.supplychain.mapper.entity.YxEvaluationProduct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

@Slf4j
@Service
public class EvaluationProductService {
    @Resource
    private EvaluationProductMapper evaluationProductMapper;

    public YxEvaluationProduct queryByBankerProductId(Integer bankerProductId) {
        Example example = new Example(YxEvaluationProduct.class);
        example.createCriteria().andEqualTo("bankerProductId", bankerProductId);
        example.setOrderByClause("id desc limit 1");
        YxEvaluationProduct bean = evaluationProductMapper.selectOneByExample(example);
        return bean;
    }

    public Integer queryStatusByBankerProductId(Integer bankerProductId) {
        YxEvaluationProduct bean = queryByBankerProductId(bankerProductId);
        if (null == bean) {
            return null;
        }
        return bean.getStatus();
    }
}
